cmake_minimum_required(VERSION 3.14)
#设置工程名字
project(udp-thread2-client LANGUAGES CXX)
project(udp-thread2-client VERSION 1.0)

set(CMAKE_AUTOUIC ON) #自动用qt的uic程序处理.ui文件
set(CMAKE_AUTOMOC ON) #自动用QT的moc程序处理
set(CMAKE_AUTORCC ON) #自动用qt的qcc程序处理资源文件

#设置支持c17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core  Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS   Network Widgets)

add_executable(udp-thread2-client
     main.cpp
     widget.cpp
     widget.h 
     widget.ui 
     taskworker.cpp
     taskworker.h
     message.cpp
     message.h



    )

#set_target_properties(udp-thread2-client PROPERTIES OUTPUT_NAME "udp-thread2-client")
#将对应的库连接到目标，类似与QT的pro文件的 -l  ,这里的第一个参数是add_library的第一个参数名.
target_link_libraries(udp-thread2-client PRIVATE Qt${QT_VERSION_MAJOR}::Network)
target_link_libraries(udp-thread2-client PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

#设置目录 EXECUTABLE_OUTPUT_PATH为CMakeLists.txt所在目录
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/qt-tcp)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
